<html>
<head>
<TITLE>CSE5317/4305 Project #2</TITLE>
</head>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<center>
<H1>CSE5317/4305 Project #2 (Parsing)</H1>
Due Tuesday March 10 at 11:59pm<p>
Worth 14% of your project grade
</center>
<p>
<hr>
<p>
The purpose of this project is to construct a parser for PCAT using CUP.
Study the <A HREF="http://www.cs.princeton.edu/~appel/modern/java/CUP/manual.html">CUP manual</a>, the parser
<a href="calc/calc.gen"><tt>calc.gen</tt></a> for the simple calculator,
and the <a href="pcat04.pdf">PCAT manual</a>.<p>
<p>
You will work on the same directory <tt>pcat</tt> from Project #1.
The only file that you need to modify is the <a href="pcat/pcat.gen">pcat.gen</a> file that contains your parser,
but you are free to update your <tt>pcat.lex</tt> file too.
You should cover all the syntactic constructs described in the <a href="pcat04.pdf">PCAT manual</a>.
At this point, you should not put any semantic actions to your grammar rules.
You need to test your parser against <b>all</b> the test files <tt>*.pcat</tt> in the
directory <tt>tests</tt>. For example, to test <tt>hello.pcat</tt>,
you execute:
<pre>
run 2 hello
</pre>
where <tt>2</tt> indicates that you are testing the second project.
The output will consist of
error messages only (if any).
To see if you got everything right,
you should modify the test files a little bit in various places so they cause syntactic errors.
You also need to compare your output with that of the solution:
<pre>
solution 2 hello
</pre>
<p>
Your <tt>pcat.gen</tt> file should not have any reduce/reduce errors
(-10 points for each reduce/reduce error) and should have as few shift/reduce errors as possible
(-2 points for each shift/reduce error). Use proper operator precedence/associativity to avoid these errors.
Use option <tt>-dump_states</tt> in CUP to display the states and find the conflicts.
Hint: in addition to operators, think also about the precedence of ELSE, ELSIF, and LPAREN.
One common mistake is to put operators separately from their use (eg,
<tt>operator ::= PLUS | MINUS | ...</tt>. This will mess up the operator precedence.
<p>
After ensuring that your program compiles and executes correctly,
update the <tt>README</tt> file that contains information about the members of your team.
Cleanup your <tt>pcat</tt> directory using
<pre>
clean
</pre>
Then, if you are using Linux, archive your file using <tt>tar cvf pcat.tar pcat</tt>.
If you are using Windows, zip the whole directory into the file <tt>pcat.zip</tt>.
Then submit your file (<tt>pcat.tar</tt> or <tt>pcat.zip</tt>) here:
<p>
<form enctype="multipart/form-data" action="https://lambda.uta.edu/cgi-bin/php/handin.php" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
    <input type="hidden" name="class" value="cse5317" />
    <input type="hidden" name="assignment" value="proj2" />
Submit this file: <input name="userfile" type="file" size="50"/><br/>
    <input type="submit" value="Send File" />
</form>
<p>
Note that you may submit your file as many times as you like, but only the most recently submitted
file will be retained.
<p>
<hr>
<P>
<ADDRESS>Last modified: 01/14/09 by <A HREF="http://lambda.uta.edu/">Leonidas Fegaras</A></ADDRESS>
